<?php
include('include/bootstrap.inc.php');



$dashboard_query = "SELECT * FROM log";
$dashboard_r = mysql_query($dashboard_query);

$urls_query = "SELECT * FROM urls ORDER BY url_id ASC";
$urls_r = mysql_query($urls_query);


echo "<h2>URLs being monitored</h2>";

while( $url_i = mysql_fetch_array( $urls_r ) ){
	echo "(".$url_i['url_id'].") ".$url_i['url']."<br>";
}

		//add URL form
			echo "<br>";
			echo "<form method=\"POST\" action=\"add_url.php\">";
			echo "<input type=\"text\" name=\"url\" size=\"50\"> <input type=\"submit\" value=\"Add URL\" /> &nbsp;<input type=\"checkbox\" name=\"strip_images\" value=\"1\" /> Strip Images? &nbsp;&nbsp; <input type=\"checkbox\" name=\"strip_comments\" value=\"1\" /> Strip Comments?";
			echo "</form>";



echo "<h2>Last 30 changes detected</h2>";




while( $info = mysql_fetch_array($dashboard_r) ){
	echo "Change detected at ".$info['log_timestamp']." between records ".$info['lower_bound']." and ".$info['upper_bound']." (url_id ".$info['url_id'].")<br>";
}


echo "<h2>Changes for the past day</h2>";

$threshold = time() - 100000;

$digest_query = "SELECT * FROM log WHERE log_timestamp > ".$threshold;
$digest_r = mysql_query($digest_query);

while( $url_d = mysql_fetch_array( $digest_r ) ){

echo $url_d['log_id']."<br>";


}



?>